package com.yungui.kafka.consumer.constant;

import java.util.*;

/**
 * @author laiaiqin
 * @since 2019/5/24
 */
public class KafkaConstant {
    public final static List<String> EVENT_TYPES = new ArrayList<>(Arrays.asList("INSERT", "UPDATE", "DELETE"));
    public final static List<String> CP_EVENT_TYPES = new ArrayList<>(Arrays.asList("INSERT", "UPDATE", "ENABLE", "DISABLE", "DELETE"));
    public final static List<String> GD_EVENT_TYPES = new ArrayList<>(Arrays.asList("INSERT", "UPDATE", "ENABLE", "DISABLE"));
    public final static List<String> INDEX_EVENT_TYPES = new ArrayList<>(Arrays.asList("INSERT", "UPDATE"));
    public final static String CONSUMER_ID = "jiaowu_consumer1";
    public final static String CONSUMER_ID2 = "jiaowu_consumer2";
    public final static String CONSUMER_ID3 = "jiaowu_consumer3";
    public final static String CONSUMER_ID4 = "jiaowu_consumer4";
    public final static String CONSUMER_ID5 = "jiaowu_consumer5";
    public final static String CONSUMER_ID6 = "jiaowu_consumer6";
    public final static String CONSUMER_ID7 = "jiaowu_consumer7";
    public final static String CONSUMER_ID9 = "jiaowu_consumer9";
    public final static String CONSUMER_ID10 = "jiaowu_consumer10";
    public final static String CONSUMER_ID11 = "jiaowu_consumer11";
    public final static String CONSUMER_ID12 = "jiaowu_consumer12";

    /**
     * 50K
     */
    public final static int MAX_FETCH_BYTES = 50 * 1024 * 1024;

    /**
     * 3秒
     */
    public final static int POLL_TIME_OUT = 3000;

    /**
     * 消息类型received_type :"INSERT", "UPDATE", "DELETE"
     */
    public final static String TYPE_INSERT = "INSERT";
    public final static String TYPE_UPDATE = "UPDATE";
    public final static String TYPE_DELETE = "DELETE";
    public final static String TYPE_ENABLE = "ENABLE";
    public final static String TYPE_DISABLE = "DISABLE";
    /**
     * 消息类型msg_type
     */
    public final static String MSG_TYPE_CREATE = "create";
    public final static String MSG_TYPE_UPDATE = "update";
    public final static String MSG_TYPE_DELETE = "delete";
    public final static String MSG_TYPE_CANCEL = "cancel";

    /**
     * 班级对外消息partition
     * create: partition 0
     * update: partition 1
     * delete: partition 2
     * cancel: partition 3
     */
    public static final Map<String, Integer> CLASS_PARTITION_MAP = new HashMap<>(4);
    static {
        CLASS_PARTITION_MAP.put(MSG_TYPE_CREATE, 0);
        CLASS_PARTITION_MAP.put(MSG_TYPE_UPDATE, 1);
        CLASS_PARTITION_MAP.put(MSG_TYPE_DELETE, 2);
        CLASS_PARTITION_MAP.put(MSG_TYPE_CANCEL, 3);
    }

    /**
     * 表名称
     */
    public final static String CLASS_TABLE = "bs_class";
    public final static String CLASS_EXTEND_TABLE="bs_class_extend";

    /**
     * 表字段名称
     */
    public final static String N_AUDIT="nAudit";
    public final static String B_VALID="bValid";
    public final static String BOOK_COST = "dcost";
    public final static String BOOK_PRICE = "dprice";

    /**
     * 常量
     */
    public final static Integer ZERO = 0;
    public final static Integer ONE = 1;

    /**
     * 两年时间戳间隔 63072000000
     */
    public final static Long TIME_DIFF = 2 * 365 * 24 * 60 * 60 * 1000L;

    private KafkaConstant() {
    }
}
